from likeshop_project.base.mybase import Tools
from likeshop_project.shopapi.category import category_model

class get_shoplist_model(Tools):
    path = '/api/goods_category/lists'
    def get_shoplist_action(self,category_id,keyword,sales_sum,price):
        mydata = {
            'category_id':category_id,
            'keyword':keyword,
            'sales_sum':sales_sum,
            'price':price
        }
        res = self.huihua.get(url=self.hosturl+self.path,params=mydata)
        return res.json()


# import requests
# s =requests.session()
# re = category_model(huihua=s)
# ma = re.category_action()
# a = ma['data'][1].get('id')
# re = get_shoplist_model(huihua=s)
# m = re.get_shoplist_action(category_id=a,keyword='小米',sales_sum='desc',price='desc')
# print(m)
# s  = m['data'][1]['id']
# print(s)

# w = {'code': 1, 'msg': '获取成功', 'data':
#     [{'id': 0, 'name': '品牌推荐', 'type': 0, 'sons':
#         [{'id': 0, 'name': '热门品牌', 'type': 0, 'sons':
#             [{'id': 5, 'name': '英雄', 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/720a002e5c6bdf95a2dd3c31737d0e57.png', 'type': 0},
#              {'id': 4, 'name': '小米', 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/8529fda6cb6c3cf62c084df9c7c911a9.png', 'type': 0},
#              {'id': 3, 'name': '得力', 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/10b16861c6eeb1e9a744b86dd69b051f.png', 'type': 0},
#              {'id': 2, 'name': '百乐', 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/2dad83f2345046d47045c160a3db6896.png', 'type': 0}, {'id': 1, 'name': '晨光文具', 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/dd2610485ad76c0d24f88f8ce58d3dd5.png', 'type': 0}]}]},
#      {'id': 1, 'name': '文具', 'pid': 0, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/d74e01d4a8b86f331fcca2f485080353.png', 'level': 1, 'sons':
#          [{'id': 4, 'name': '晨光', 'pid': 1, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/dd2610485ad76c0d24f88f8ce58d3dd5.png', 'level': 2, 'sons':
#              [{'id': 9, 'name': '中性笔', 'pid': 4, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/dceddf4cb321cf612eee441477d3b93f.png', 'level': 3, 'type': 1},
#               {'id': 10, 'name': '铅笔', 'pid': 4, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/47829c77b7b5135de799182d1c197746.png', 'level': 3, 'type': 1}], 'type': 1},
#           {'id': 5, 'name': '小米', 'pid': 1, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/8529fda6cb6c3cf62c084df9c7c911a9.png', 'level': 2, 'sons':
#               [{'id': 11, 'name': '小米中性笔', 'pid': 5, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/3261d7a8935ca47e0f19b354a36bab79.png', 'level': 3, 'type': 1},
#                {'id': 12, 'name': '小米铅笔', 'pid': 5, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/d97a7d56854eb8cd5afa228b1d9608c3.png', 'level': 3, 'type': 1}], 'type': 1},
#           {'id': 6, 'name': '得力', 'pid': 1, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/10b16861c6eeb1e9a744b86dd69b051f.png', 'level': 2, 'sons': [{'id': 13, 'name': '得力中性笔', 'pid': 6, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/d0fd78d3b5de45b870f43b6db3d5a0be.png', 'level': 3, 'type': 1}], 'type': 1},
#           {'id': 7, 'name': '英雄', 'pid': 1, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/720a002e5c6bdf95a2dd3c31737d0e57.png', 'level': 2, 'sons': [{'id': 14, 'name': '英雄钢笔', 'pid': 7, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/5e11c751c7e662764764e132ab6a8f72.png', 'level': 3, 'type': 1}], 'type': 1},
#           {'id': 8, 'name': '百乐', 'pid': 1, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/2dad83f2345046d47045c160a3db6896.png', 'level': 2, 'sons': [{'id': 15, 'name': '百乐钢笔', 'pid': 8, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/63d91cdfdb659e57a10a99d1cf44567e.png', 'level': 3, 'type': 1}], 'type': 1}], 'type': 1},
#      {'id': 2, 'name': '专场推荐', 'pid': 0, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/eab147f969fce1475d4892c57256f8ec.png', 'level': 1, 'type': 1}, {'id': 3, 'name': '热门分类', 'pid': 0, 'image': 'http://114.132.200.42:81/uploads/images/background/20201210/79ee4347c8066f965c9ce7034f249cea.png', 'level': 1, 'type': 1},
#      {'id': 16, 'name': '电器', 'pid': 0, 'image': 'http://114.132.200.42:81/uploads/images/20230401163723f8c3c8138.png', 'level': 1, 'sons': [{'id': 17, 'name': '家用电器', 'pid': 16, 'image': 'http://114.132.200.42:81/uploads/images/20230401163829699714740.png', 'level': 2, 'sons':
#          [{'id': 18, 'name': '电视机', 'pid': 17, 'image': 'http://114.132.200.42:81/uploads/images/20230401163829699714740.png', 'level': 3, 'type': 1}], 'type': 1}], 'type': 1}], 'show': 0, 'time': '0.035509'}
